#ifndef LEVEL_H
#define LEVEL_H
#include <vector>
#include "Brick.h"
#include "Animation.h"
#include "Ball.h"
#include "Bonus.h"
#include "Panel.h"
#include "Settings.h"
#include <vector>
#include <list>
#include <utility>
#include "tinyxml/tinyxml.h"

class Level
{
    friend class GameState;
    friend class Bonus;
    friend class Brick;
    friend class DevConsole;

    public:

        Level(std::string fileName);
        ~Level();
        void draw(sf::RenderWindow* Window);
        void update(int x);
        void reset();


    private:
        int amountOfBricks;
        enum STATE{START, PLAYING, END};
        bool levelComplete;
        bool paused;
        STATE lvlState;
        Panel panel;
        std::list<Ball*> balls;
        std::list<Brick*> bricks;
        std::list<Bonus*> bonuses;
        std::list<Animation*> animations;
        sf::Text startText;
        sf::Text endText;
        thor::FrameAnimation::Ptr frameAni;

        void load(std::string fileName);
        void randomBonus(int x, int y);
        void onLevelCompleted();
        void mousePressed();
        void addExplosion(int x, int y);
        void onBallMissed();
        void addBall();
        void collisionUpdate();
};

#endif // LEVEL_H
